<template>
  <div class="mod-config">
    <el-card class="box-card search-input" shadow="never">
      <el-form label-width="120px" size="mini" :model="dataForm" @keyup.enter.native="findPage()">
        <el-row label-width="120px" size="mini">
          <el-col :span="6">
            <el-form-item label="主播手机号：" prop="account">
              <el-input v-model="dataForm.account"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="主播姓名：" prop="name">
              <el-input v-model="dataForm.name"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="主播身份证：" prop="identityCode">
              <el-input v-model="dataForm.identityCode"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="审核状态：" prop="auditStatus">
              <el-select style="width: 100%" v-model="dataForm.auditStatus">
                <el-option
                  v-for="item in auditAnchorStatus"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24" style="text-align: center;">
            <el-form-item>
              <el-button type="primary" @click="$refs.CyTable.query(dataForm)">查询</el-button>
              <el-button @click="reset">重置</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-card>
    <cy-table
      url="/api/v1/broadcast/shopApplyForAnchor"
      :max-height="500"
      :showSelection="false"
      :highlightCurrentRow="true"
      :operationWidth="250"
      :totalSize="totalSize"
      :columns="filterColumns"
      :showOperation="false"
      @findPage="findPage"
      ref="CyTable"
    >
    </cy-table>
  </div>
</template>
<script>
  import CyTable from "./component/CyTable";
  export default {
    components: {
      CyTable
    },
    data() {
      return {
        loading: false,
        moreBtnDisable: true,
        auditAnchorStatus: [{
          label: '全部'
        }, {
          value: 1,
          label: '审核通过'
        }, {
          value: 2,
          label: '审核不通过'
        }],
        dataForm: {},
        columns: [],
        filterColumns: [],
        totalSize: 0,
        operation: false, // true:新增, false:编辑
        dialogVisible: false, // 新增编辑界面是否显示
        editLoading: false,
        dataList: [],
        pageIndex: 1,
        pageSize: 10,
        totalPage: 0,
        dataListSelections: [],
      }
    },
    mounted: function () {
      this.columns = [
        {prop: "id", label: "序号", minWidth: 120},
        {prop: "createTime", label: "申请时间", minWidth: 160},
        {prop: "account", label: "主播手机号", minWidth: 120},
        {prop: "name", label: "主播姓名", minWidth: 120},
        {prop: "identityCode", label: "身份证号码", minWidth: 160, formatter: this.defaultVal},
        {prop: "handPhoto", label: "照片", minWidth: 120, showType: 'image', imgSize: {width: 60, height: 60}},
        {prop: "updateTime", label: "审核时间", minWidth: 160},
        {prop: "auditStatus", label: "审核状态", minWidth: 120, formatter: this.auditAnchorOption},
      ];
      let temp = [];
      this.columns.forEach(function (key, val) {
        temp.push(key);
      });
      this.filterColumns = temp;
    },
    methods: {
      auditAnchorOption(row, column, cellValue, index) {
        //审核状态 审核进行中 1 审核通过 2 审核不通过
        if (cellValue == 1) {
          return "审核通过";
        } else if (cellValue == 2) {
          return "审核不通过";
        }
        return "审核中";
      },
      // 获取数据列表
      findPage() {
        this.$refs.CyTable.findPage(this.dataForm);
      },
      // 每页数
      sizeChangeHandle(val) {
        this.pageSize = val
        this.pageIndex = 1
        this.findPage()
      },
      //重置
      reset() {
        this.dataForm = {};
        this.$refs.CyTable.resetForm(this.dataForm);
      },
    }
  }
</script>
<style scoped lang="scss">

</style>
